home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 2
/
Amoszine 2.adf
/
MORE_SOURCE_CODE
/
Powerpacker.AMOS
/
Powerpacker.amosSourceCode
Wrap
AMOS Source Code
|
1992-02-26
|
2KB
|
69 lines
'=====================================================================
' Compression tutorial, By A. Smith for Amoszine
' "Compressing with PowerPacker" - Using Ppload and Ppsave.
'=====================================================================
' Open lowres screen to hold our image
Screen Open 0,320,256,32,Lowres
Flash Off : Curs Off
' Open screen for messages
Screen Open 1,320,30,2,Lowres
Screen Display 1,,150,,
Flash Off : Curs Off
' Load the IFF image
Screen 0
Load Iff Fsel$("","","Please select an IFF picture","")
Wait Vbl
' Pack as screen into bank 15 (what a poet!)
Screen 1 : Print "Packing picture into bank 15" : Screen 0
Spack 0 To 15
' Save memory bank to disk
Screen 1 : Print "Size of packed image ";Length(15) : Screen 0
F$=Fsel$("","","Give filename for ABK image","Ensure it ends in .ABK")
Save F$,15
' Get size of saved ABK file and store in L
Open In 1,F$
L=Lof(1)
Close 1
' Powerpack memory bank 15 with 'best' compression
Screen 1 : Print "Powerpacking memory bank" : Screen 0
Cls
F$=Fsel$("","","Give filename for Powerpacked file","Ensure it ends in .PP")
Extension_5_0106 F$,15,4
Screen 1 : Print "File powerpacked!" : Screen 0
' Reopen the file I saved out so the length of the file can be returned.
Open In 1,F$
' Get length of file and store in SIZEOFFILE
SIZEOFFILE=Lof(1)
Close 1
' Decompress powerpacked memory bank and store in bank 15.
Extension_5_0120 F$,15
' Redisplay the picture!
Unpack 15 To 0
Screen To Front 1
Screen 1 : Print "Saved ";L-SIZEOFFILE;" bytes!"